package com.wicket.okrapp.base.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;


import com.wicket.okrapp.base.service.MOmsCycleService;
import com.wicket.okrapp.base.service.dto.req.*;
import com.wicket.okrapp.common.annotations.BanAuto;
import com.wicket.okrapp.common.dto.FieldInfo;
import com.wicket.okrapp.common.exception.BizException;
import com.wicket.okrapp.common.util.CommonFunctionHelper;
import com.wicket.okrapp.dal.mapper.mbg.OmsCycleMapper;
import com.wicket.okrapp.dal.po.mbg.OmsCycle;
import org.apache.skywalking.apm.toolkit.trace.Tag;
import org.apache.skywalking.apm.toolkit.trace.Tags;
import org.apache.skywalking.apm.toolkit.trace.Trace;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

/**
 * @author ：
 * @since 2022/1/19 15:39
 *
 *
 * @version 1.0
 */
@Service
public class MOmsCycleServiceImpl
        extends ServiceImpl<OmsCycleMapper, OmsCycle>
        implements MOmsCycleService {

    @Autowired
    OmsCycleMapper omsCycleMapper;

    /**
   * 3-4-04新增周期[2001]
   * gen by moon at 1/1/2023, 5:12:21 PM
   */
 @Trace(operationName = "3-4-04新增周期")
 @Tags({@Tag(key = "参数",value = "arg[0]"),
 @Tag(key = "返回值",value = "returnedObj")})
  @Override
  @Transactional(rollbackFor=Exception.class)
  public  String  addCycle(OmsCycle omsCycle) {
     omsCycle.setCycleId(CommonFunctionHelper.getUid());//DISTRIBUTED_ID
omsCycle.setIsArchive("FALSE");
omsCycle.setOperationInductionId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecInductionRecordId());//CURRENT_INDUCTIONID
omsCycle.setCreateInductionId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecInductionRecordId());//CURRENT_INDUCTIONID
if(omsCycle!=null && omsCycle.getSubjectLifeCycle()!=null &&  omsCycle.getSubjectLifeCycle().equals("CURRENTLY_VALID")) {
            omsCycle.setReleaseInductionId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecInductionRecordId());//RELEASED_CURRENT_INDUCTIONID
          }
omsCycle.setOperateTime(CommonFunctionHelper.getCurrentTime());//SYSTEM_CURRENT_TIME
omsCycle.setCreateTime(CommonFunctionHelper.getCurrentTime());//SYSTEM_CURRENT_TIME
if(omsCycle!=null && omsCycle.getSubjectLifeCycle()!=null && omsCycle.getSubjectLifeCycle().equals("CURRENTLY_VALID")){
             omsCycle.setReleaseTime(CommonFunctionHelper.getCurrentTime());//RELEASE_SYSTEM_CURRENT_TIME
            }
omsCycle.setIsValid("FALSE");
omsCycle.setSpaceId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecSpaceId());//CURRENT_SPACEID
omsCycle.setAppId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecAppId());//CURRENT_APPID
     if(super.save(omsCycle)){
        return omsCycle.getCycleId();
     }else {
        return "-1";
     }
    
  }

    /**
   * 3-4-04批量查周期列表[2249]
   * gen by moon at 1/1/2023, 5:12:24 PM
   */
 @Trace(operationName = "3-4-04批量查周期列表")
 @Tags({@Tag(key = "参数",value = "arg[0]"),
 @Tag(key = "返回值",value = "returnedObj")})
  @Override
  @Transactional(rollbackFor=Exception.class)
  public  List<OmsCycle>  batchQueryCycle(BatchQueryCycleReq reqDto) {
     
        try {
            QueryWrapper<OmsCycle> queryWrapper = new QueryWrapper<>();
            reqDto.setIsValid("FALSE");
            if(reqDto.getCycleList()==null || reqDto.getCycleList().isEmpty()){
                    return new ArrayList<>();
                }
        queryWrapper.in("cycle_id", reqDto.getCycleList());
            Map<String, Object> fieldInfoMap = null;
            fieldInfoMap = CommonFunctionHelper.objectToMapForLamBda(reqDto);
            List<FieldInfo> compareList = CommonFunctionHelper.getRangeField(OmsCycle.class);
            CommonFunctionHelper.buildQueryWrapperCompare(queryWrapper, compareList, fieldInfoMap);
            List<FieldInfo> likeList = CommonFunctionHelper.getLikeFiled(OmsCycle.class);
            CommonFunctionHelper.buildQueryWrapperLike(queryWrapper,likeList,fieldInfoMap);
            likeList.addAll(compareList);
            CommonFunctionHelper.buildQueryWrapperEq(queryWrapper, fieldInfoMap,likeList);
            List<FieldInfo> orderList = CommonFunctionHelper.getOrderList(OmsCycle.class);
            //CommonFunctionHelper.buildQueryWrapperOrder(queryWrapper, orderList);
            queryWrapper.orderByDesc("order_number");
queryWrapper.orderByDesc("operate_time");
            return ((List<OmsCycle>) super.list(queryWrapper));
        } catch (Exception e) {
            e.printStackTrace();
            throw new BizException("-1",e,false);
        }
  }

    /**
   * 3-4-04批量查周期列表By类型Code[2491]
   * gen by moon at 9/14/2022, 4:24:30 AM
   */
 @Trace(operationName = "3-4-04批量查周期列表By类型Code")
 @Tags({@Tag(key = "参数",value = "arg[0]"),
 @Tag(key = "返回值",value = "returnedObj")})
  @Override
 @BanAuto
  @Transactional(rollbackFor=Exception.class)
  public  List<OmsCycle>  batchQueryCycleByCycCode(BatchQueryCycleByCycCodeReq reqDto) {
     
        try {
            QueryWrapper<OmsCycle> queryWrapper = new QueryWrapper<>();
            reqDto.setIsValid("FALSE");
            if(reqDto.getCycleList()==null || reqDto.getCycleList().isEmpty()){
                    return new ArrayList<>();
                }
        queryWrapper.in("cycle_type_code", reqDto.getCycleList());

            if(reqDto.getCycleStartTime()!=null && reqDto.getCycleEndTime()!=null){
                queryWrapper.ge("cycle_start_time",reqDto.getCycleStartTime());
                queryWrapper.le("cycle_end_time",reqDto.getCycleEndTime());
                reqDto.setCycleStartTime(null);
                reqDto.setCycleEndTime(null);
            }
            Map<String, Object> fieldInfoMap = null;
            fieldInfoMap = CommonFunctionHelper.objectToMapForLamBda(reqDto);
            List<FieldInfo> compareList = CommonFunctionHelper.getRangeField(OmsCycle.class);
            CommonFunctionHelper.buildQueryWrapperCompare(queryWrapper, compareList, fieldInfoMap);
            List<FieldInfo> likeList = CommonFunctionHelper.getLikeFiled(OmsCycle.class);
            CommonFunctionHelper.buildQueryWrapperLike(queryWrapper,likeList,fieldInfoMap);
            likeList.addAll(compareList);
            CommonFunctionHelper.buildQueryWrapperEq(queryWrapper, fieldInfoMap,likeList);
            List<FieldInfo> orderList = CommonFunctionHelper.getOrderList(OmsCycle.class);
            //CommonFunctionHelper.buildQueryWrapperOrder(queryWrapper, orderList);
            queryWrapper.orderByAsc("order_number");
            
            return ((List<OmsCycle>) super.list(queryWrapper));
        } catch (Exception e) {
            e.printStackTrace();
            throw new BizException("-1",e,false);
        }
  }

    /**
     * M生成周期排序(特殊方法）
     */
    @Trace(operationName = "M生成周期排序(特殊方法）")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Override
    @Transactional(rollbackFor = Exception.class)
    public String generateOrderNumber(OmsCycle omsCycle) {

        if (super.save(omsCycle)) {
            return omsCycle.getCycleId();
        } else {
            return "-1";
        }

    }

    /**
   * 3-4-04删除周期[2005]
   * gen by moon at 1/1/2023, 5:12:23 PM
   */
 @Trace(operationName = "3-4-04删除周期")
 @Tags({@Tag(key = "参数",value = "arg[0]"),
 @Tag(key = "返回值",value = "returnedObj")})
  @Override
  @Transactional(rollbackFor=Exception.class)
  public  boolean  deleteCycle(String cycleId ) {
     
      return super.removeById(cycleId);
  }

    /**
   * 3-4-04查询周期详情[2004]
   * gen by moon at 9/7/2022, 7:10:01 PM
   */
 @Trace(operationName = "3-4-04查询周期详情")
 @Tags({@Tag(key = "参数",value = "arg[0]"),
 @Tag(key = "返回值",value = "returnedObj")})
  @Override
 @BanAuto
  @Transactional(rollbackFor=Exception.class)
  public  OmsCycle  queryCycleDetail(QueryCycleDetailReq reqDto) {
     
        try {
         reqDto.setIsValid("FALSE");
            QueryWrapper<OmsCycle> queryWrapper = new QueryWrapper<>();
            if(reqDto.getCycleStartTime()!=null && reqDto.getCycleEndTime()!=null){
                queryWrapper.ge("cycle_start_time",reqDto.getCycleStartTime());
                queryWrapper.le("cycle_end_time",reqDto.getCycleEndTime());
                reqDto.setCycleStartTime(null);
                reqDto.setCycleEndTime(null);
            }
            Map<String, Object> fieldInfoMap = null;
            fieldInfoMap = CommonFunctionHelper.objectToMapForLamBda(reqDto);
            CommonFunctionHelper.buildQueryWrapperEq(queryWrapper, fieldInfoMap, new ArrayList<>());
            queryWrapper.orderByDesc("create_time");
            List<OmsCycle> retList = super.list(queryWrapper);
            if(retList!=null && retList.size()>0){
                OmsCycle retData = retList.get(0);

                return retData;
            }
            return null;
      } catch (Exception e) {
          e.printStackTrace();
          throw new BizException("-1",e,false);
      }
  }

    /**
   * 3-4-04查询周期列表[2003]
   * gen by moon at 9/14/2022, 4:24:28 AM
   */
 @Trace(operationName = "3-4-04查询周期列表")
 @Tags({@Tag(key = "参数",value = "arg[0]"),
 @Tag(key = "返回值",value = "returnedObj")})
  @Override
 @BanAuto
  @Transactional(rollbackFor=Exception.class)
  public  List<OmsCycle>  queryCycleList(QueryCycleListReq reqDto) {
     
        try {
            QueryWrapper<OmsCycle> queryWrapper = new QueryWrapper<>();
            reqDto.setIsValid("FALSE");
            if(reqDto.getCycleStartTime()!=null && reqDto.getCycleEndTime()!=null){
                queryWrapper.ge("cycle_start_time",reqDto.getCycleStartTime());
                queryWrapper.le("cycle_end_time",reqDto.getCycleEndTime());
                reqDto.setCycleStartTime(null);
                reqDto.setCycleEndTime(null);
            }
            
            Map<String, Object> fieldInfoMap = null;
            fieldInfoMap = CommonFunctionHelper.objectToMapForLamBda(reqDto);
            List<FieldInfo> compareList = CommonFunctionHelper.getRangeField(OmsCycle.class);
            CommonFunctionHelper.buildQueryWrapperCompare(queryWrapper, compareList, fieldInfoMap);
            List<FieldInfo> likeList = CommonFunctionHelper.getLikeFiled(OmsCycle.class);
            CommonFunctionHelper.buildQueryWrapperLike(queryWrapper,likeList,fieldInfoMap);
            likeList.addAll(compareList);
            CommonFunctionHelper.buildQueryWrapperEq(queryWrapper, fieldInfoMap,likeList);
            List<FieldInfo> orderList = CommonFunctionHelper.getOrderList(OmsCycle.class);
            //CommonFunctionHelper.buildQueryWrapperOrder(queryWrapper, orderList);
            queryWrapper.orderByDesc("order_number");
queryWrapper.orderByDesc("operate_time");
            return ((List<OmsCycle>) super.list(queryWrapper));
        } catch (Exception e) {
            e.printStackTrace();
            throw new BizException("-1",e,false);
        }
  }

    /**
   * 3-4-04修改周期[2002]
   * gen by moon at 1/1/2023, 5:12:22 PM
   */
 @Trace(operationName = "3-4-04修改周期")
 @Tags({@Tag(key = "参数",value = "arg[0]"),
 @Tag(key = "返回值",value = "returnedObj")})
  @Override
  @Transactional(rollbackFor=Exception.class)
  public  boolean  updateCycle(OmsCycle omsCycle) {
     omsCycle.setOperationInductionId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecInductionRecordId());//CURRENT_INDUCTIONID
if(omsCycle!=null && omsCycle.getSubjectLifeCycle()!=null &&  omsCycle.getSubjectLifeCycle().equals("CURRENTLY_VALID")) {
            omsCycle.setReleaseInductionId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecInductionRecordId());//RELEASED_CURRENT_INDUCTIONID
          }
if(omsCycle!=null && omsCycle.getSubjectLifeCycle()!=null && omsCycle.getSubjectLifeCycle().equals("ARCHIVING")) {
              omsCycle.setArchiveInductionId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecInductionRecordId());//ARCHIVE_CURRENT_INDUCTIONID
          }
omsCycle.setOperateTime(CommonFunctionHelper.getCurrentTime());//SYSTEM_CURRENT_TIME
if(omsCycle!=null && omsCycle.getSubjectLifeCycle()!=null && omsCycle.getSubjectLifeCycle().equals("CURRENTLY_VALID")){
             omsCycle.setReleaseTime(CommonFunctionHelper.getCurrentTime());//RELEASE_SYSTEM_CURRENT_TIME
            }
if(omsCycle!=null && omsCycle.getSubjectLifeCycle()!=null && omsCycle.getSubjectLifeCycle().equals("ARCHIVING")) {
              omsCycle.setArchiveTime(CommonFunctionHelper.getCurrentTime());//HISTORICAL_ARCHIVING
          }
        return super.updateById(omsCycle);
  }
/**
   * 3-4-04查询判断周期详情[3409]
   * gen by moon at 9/14/2022, 4:24:31 AM
   */
 @Trace(operationName = "3-4-04查询判断周期详情")
 @Tags({@Tag(key = "参数",value = "arg[0]"),
 @Tag(key = "返回值",value = "returnedObj")})
  @Override
 @BanAuto
  @Transactional(rollbackFor=Exception.class)
  public  OmsCycle  queryJudgeCycleDetail(QueryJudgeCycleDetailReq reqDto) {
     
        try {
         reqDto.setIsValid("FALSE");
            QueryWrapper<OmsCycle> queryWrapper = new QueryWrapper<>();
            if(reqDto.getCycleStartTime()!=null && reqDto.getCycleEndTime()!=null){
                queryWrapper.le("cycle_start_time",reqDto.getCycleStartTime());
                queryWrapper.ge("cycle_end_time",reqDto.getCycleEndTime());
                reqDto.setCycleStartTime(null);
                reqDto.setCycleEndTime(null);
            }
            Map<String, Object> fieldInfoMap = null;
            fieldInfoMap = CommonFunctionHelper.objectToMapForLamBda(reqDto);
            CommonFunctionHelper.buildQueryWrapperEq(queryWrapper, fieldInfoMap, new ArrayList<>());
            queryWrapper.orderByDesc("create_time");
            List<OmsCycle> retList = super.list(queryWrapper);
            if(retList!=null && retList.size()>0){
                OmsCycle retData = retList.get(0);

                return retData;
            }
            return null;
      } catch (Exception e) {
          e.printStackTrace();
          throw new BizException("-1",e,false);
      }
  }
/**
   * 3-4-04查询历史周期列表[3690]
   * gen by moon at 10/16/2022, 7:12:45 AM
   */
 @Trace(operationName = "3-4-04查询历史周期列表")
 @Tags({@Tag(key = "参数",value = "arg[0]"),
 @Tag(key = "返回值",value = "returnedObj")})
  @Override
  @Transactional(rollbackFor=Exception.class)
 @BanAuto
  public  List<OmsCycle>  queryHistoryCycleList(QueryHistoryCycleListReq reqDto) {
     
        try {
            QueryWrapper<OmsCycle> queryWrapper = new QueryWrapper<>();
            if(reqDto.getCycleStartTime()!=null && reqDto.getCycleEndTime()!=null){
                queryWrapper.le("cycle_start_time",reqDto.getCycleStartTime());
                queryWrapper.le("cycle_end_time",reqDto.getCycleEndTime());
                reqDto.setCycleStartTime(null);
                reqDto.setCycleEndTime(null);
            }
            
            Map<String, Object> fieldInfoMap = null;
            fieldInfoMap = CommonFunctionHelper.objectToMapForLamBda(reqDto);
            List<FieldInfo> compareList = CommonFunctionHelper.getRangeField(OmsCycle.class);
            CommonFunctionHelper.buildQueryWrapperCompare(queryWrapper, compareList, fieldInfoMap);
            List<FieldInfo> likeList = CommonFunctionHelper.getLikeFiled(OmsCycle.class);
            CommonFunctionHelper.buildQueryWrapperLike(queryWrapper,likeList,fieldInfoMap);
            likeList.addAll(compareList);
            CommonFunctionHelper.buildQueryWrapperEq(queryWrapper, fieldInfoMap,likeList);
            List<FieldInfo> orderList = CommonFunctionHelper.getOrderList(OmsCycle.class);
            //CommonFunctionHelper.buildQueryWrapperOrder(queryWrapper, orderList);
            
            return ((List<OmsCycle>) super.list(queryWrapper));
        } catch (Exception e) {
            e.printStackTrace();
            throw new BizException("-1",e,false);
        }
  }
/**
   * 3-4-04查询子周期列表[3716]
   * gen by moon at 1/1/2023, 5:12:25 PM
   */
 @Trace(operationName = "3-4-04查询子周期列表")
 @Tags({@Tag(key = "参数",value = "arg[0]"),
 @Tag(key = "返回值",value = "returnedObj")})
  @Override
  @Transactional(rollbackFor=Exception.class)
  public  List<OmsCycle>  querySubcycleList(QuerySubcycleListReq reqDto) {
     
        try {
            QueryWrapper<OmsCycle> queryWrapper = new QueryWrapper<>();
            reqDto.setIsValid("FALSE");
            
            Map<String, Object> fieldInfoMap = null;
            fieldInfoMap = CommonFunctionHelper.objectToMapForLamBda(reqDto);
            List<FieldInfo> compareList = CommonFunctionHelper.getRangeField(OmsCycle.class);
            CommonFunctionHelper.buildQueryWrapperCompare(queryWrapper, compareList, fieldInfoMap);
            List<FieldInfo> likeList = CommonFunctionHelper.getLikeFiled(OmsCycle.class);
            CommonFunctionHelper.buildQueryWrapperLike(queryWrapper,likeList,fieldInfoMap);
            likeList.addAll(compareList);
            CommonFunctionHelper.buildQueryWrapperEq(queryWrapper, fieldInfoMap,likeList);
            List<FieldInfo> orderList = CommonFunctionHelper.getOrderList(OmsCycle.class);
            //CommonFunctionHelper.buildQueryWrapperOrder(queryWrapper, orderList);
            
            return ((List<OmsCycle>) super.list(queryWrapper));
        } catch (Exception e) {
            e.printStackTrace();
            throw new BizException("-1",e,false);
        }
  }
/**
   * M3-查询单条周期详情[4299]
   * gen by moon at 3/30/2023, 6:54:10 PM
   */
 @Trace(operationName = "M3-查询单条周期详情")
 @Tags({@Tag(key = "参数",value = "arg[0]"),
 @Tag(key = "返回值",value = "returnedObj")})
  @Override
  @Transactional(rollbackFor=Exception.class)
  public  OmsCycle  querySingleCycleDetail(QuerySingleCycleDetailReq reqDto) {
     
        try {
         reqDto.setIsValid("FALSE");
            QueryWrapper<OmsCycle> queryWrapper = new QueryWrapper<>();
            Map<String, Object> fieldInfoMap = null;
            fieldInfoMap = CommonFunctionHelper.objectToMapForLamBda(reqDto);
            CommonFunctionHelper.buildQueryWrapperEq(queryWrapper, fieldInfoMap, new ArrayList<>());
            queryWrapper.orderByDesc("create_time");
            List<OmsCycle> retList = super.list(queryWrapper);
            if(retList!=null && retList.size()>0){
                OmsCycle retData = retList.get(0);
                
                return retData;
            }
            return null;
      } catch (Exception e) {
          e.printStackTrace();
          throw new BizException("-1",e,false);
      }
  }
/**
   * 3-4-04查询周期倒序列表[4758]
   * gen by moon at 1/1/2023, 5:12:26 PM
   */
 @Trace(operationName = "3-4-04查询周期倒序列表")
 @Tags({@Tag(key = "参数",value = "arg[0]"),
 @Tag(key = "返回值",value = "returnedObj")})
  @Override
  @Transactional(rollbackFor=Exception.class)
  public  List<OmsCycle>  queryCycleSortList(QueryCycleSortListReq reqDto) {
     
        try {
            QueryWrapper<OmsCycle> queryWrapper = new QueryWrapper<>();
            reqDto.setIsValid("FALSE");
            
            Map<String, Object> fieldInfoMap = null;
            fieldInfoMap = CommonFunctionHelper.objectToMapForLamBda(reqDto);
            List<FieldInfo> compareList = CommonFunctionHelper.getRangeField(OmsCycle.class);
            CommonFunctionHelper.buildQueryWrapperCompare(queryWrapper, compareList, fieldInfoMap);
            List<FieldInfo> likeList = CommonFunctionHelper.getLikeFiled(OmsCycle.class);
            CommonFunctionHelper.buildQueryWrapperLike(queryWrapper,likeList,fieldInfoMap);
            likeList.addAll(compareList);
            CommonFunctionHelper.buildQueryWrapperEq(queryWrapper, fieldInfoMap,likeList);
            List<FieldInfo> orderList = CommonFunctionHelper.getOrderList(OmsCycle.class);
            //CommonFunctionHelper.buildQueryWrapperOrder(queryWrapper, orderList);
            queryWrapper.orderByAsc("order_number");
queryWrapper.orderByDesc("operate_time");
            return ((List<OmsCycle>) super.list(queryWrapper));
        } catch (Exception e) {
            e.printStackTrace();
            throw new BizException("-1",e,false);
        }
  }
/**
   * 3-4-04查询中期周期详情[4827]
   * gen by moon at 10/11/2022, 8:11:44 PM
   */
 @Trace(operationName = "3-4-04查询中期周期详情")
 @Tags({@Tag(key = "参数",value = "arg[0]"),
 @Tag(key = "返回值",value = "returnedObj")})
  @Override
 @BanAuto
  @Transactional(rollbackFor=Exception.class)
  public  OmsCycle  queryMidCycleDetail(QueryMidCycleDetailReq reqDto) {
     
        try {
         reqDto.setIsValid("FALSE");
            QueryWrapper<OmsCycle> queryWrapper = new QueryWrapper<>();
            if(reqDto.getCycleStartTime()!=null && reqDto.getCycleEndTime()!=null){
                queryWrapper.eq("cycle_start_time",reqDto.getCycleStartTime());
                queryWrapper.le("cycle_end_time",reqDto.getCycleEndTime());
                reqDto.setCycleStartTime(null);
                reqDto.setCycleEndTime(null);
            }
            Map<String, Object> fieldInfoMap = null;
            fieldInfoMap = CommonFunctionHelper.objectToMapForLamBda(reqDto);
            CommonFunctionHelper.buildQueryWrapperEq(queryWrapper, fieldInfoMap, new ArrayList<>());
            queryWrapper.orderByDesc("create_time");
            List<OmsCycle> retList = super.list(queryWrapper);
            if(retList!=null && retList.size()>0){
                OmsCycle retData = retList.get(0);

                return retData;
            }
            return null;
      } catch (Exception e) {
          e.printStackTrace();
          throw new BizException("-1",e,false);
      }
  }
/**
   * 3-4-04查询时间匹配周期列表[4981]
   * gen by moon at 1/1/2023, 5:12:27 PM
   */
 @Trace(operationName = "3-4-04查询时间匹配周期列表")
 @Tags({@Tag(key = "参数",value = "arg[0]"),
 @Tag(key = "返回值",value = "returnedObj")})
  @Override
  @Transactional(rollbackFor=Exception.class)
  public  List<OmsCycle>  queryTimeMatchCycleList(QueryTimeMatchCycleListReq reqDto) {
     
        try {
            QueryWrapper<OmsCycle> queryWrapper = new QueryWrapper<>();
            reqDto.setIsValid("FALSE");
            
            Map<String, Object> fieldInfoMap = null;
            fieldInfoMap = CommonFunctionHelper.objectToMapForLamBda(reqDto);
            List<FieldInfo> compareList = CommonFunctionHelper.getRangeField(OmsCycle.class);
            CommonFunctionHelper.buildQueryWrapperCompare(queryWrapper, compareList, fieldInfoMap);
            List<FieldInfo> likeList = CommonFunctionHelper.getLikeFiled(OmsCycle.class);
            CommonFunctionHelper.buildQueryWrapperLike(queryWrapper,likeList,fieldInfoMap);
            likeList.addAll(compareList);
            CommonFunctionHelper.buildQueryWrapperEq(queryWrapper, fieldInfoMap,likeList);
            List<FieldInfo> orderList = CommonFunctionHelper.getOrderList(OmsCycle.class);
            //CommonFunctionHelper.buildQueryWrapperOrder(queryWrapper, orderList);
            
            return ((List<OmsCycle>) super.list(queryWrapper));
        } catch (Exception e) {
            e.printStackTrace();
            throw new BizException("-1",e,false);
        }
  }
/**
   * 3-4-04查询时间匹配周期详情[4985]
   * gen by moon at 10/23/2022, 12:04:15 AM
   */
 @Trace(operationName = "3-4-04查询时间匹配周期详情")
 @Tags({@Tag(key = "参数",value = "arg[0]"),
 @Tag(key = "返回值",value = "returnedObj")})
  @Override
  @Transactional(rollbackFor=Exception.class)
 @BanAuto
  public  OmsCycle  queryTimeMatchCycleDetail(QueryTimeMatchCycleDetailReq reqDto) {

        try {
         reqDto.setIsValid("FALSE");
            QueryWrapper<OmsCycle> queryWrapper = new QueryWrapper<>();
            if(reqDto.getCycleStartTime()!=null && reqDto.getCycleEndTime()!=null){
                queryWrapper.lt("cycle_start_time",reqDto.getCycleStartTime());
                queryWrapper.gt("cycle_end_time",reqDto.getCycleEndTime());
                reqDto.setCycleStartTime(null);
                reqDto.setCycleEndTime(null);
            }

            Map<String, Object> fieldInfoMap = null;
            fieldInfoMap = CommonFunctionHelper.objectToMapForLamBda(reqDto);
            CommonFunctionHelper.buildQueryWrapperEq(queryWrapper, fieldInfoMap, new ArrayList<>());
            queryWrapper.orderByDesc("create_time");
            List<OmsCycle> retList = super.list(queryWrapper);
            if(retList!=null && retList.size()>0){
                OmsCycle retData = retList.get(0);

                return retData;
            }
            return null;
      } catch (Exception e) {
          e.printStackTrace();
          throw new BizException("-1",e,false);
      }
  }
/**
   * 3-4-04查询周期时间匹配周期详情[5068]
   * gen by moon at 10/30/2022, 7:02:35 PM
   */
 @Trace(operationName = "3-4-04查询周期时间匹配周期详情")
 @Tags({@Tag(key = "参数",value = "arg[0]"),
 @Tag(key = "返回值",value = "returnedObj")})
  @Override
  @Transactional(rollbackFor=Exception.class)
 @BanAuto
  public  OmsCycle  queryCycleTimeMatchingCycleDetail(QueryCycleTimeMatchingCycleDetailReq reqDto) {

        try {
         reqDto.setIsValid("FALSE");
            QueryWrapper<OmsCycle> queryWrapper = new QueryWrapper<>();
            if(reqDto.getCycleStartTime()!=null && reqDto.getCycleEndTime()!=null){
                queryWrapper.ge("cycle_start_time",reqDto.getCycleStartTime());
                queryWrapper.le("cycle_end_time",reqDto.getCycleEndTime());
                reqDto.setCycleStartTime(null);
                reqDto.setCycleEndTime(null);
            }
            Map<String, Object> fieldInfoMap = null;
            fieldInfoMap = CommonFunctionHelper.objectToMapForLamBda(reqDto);
            CommonFunctionHelper.buildQueryWrapperEq(queryWrapper, fieldInfoMap, new ArrayList<>());
            queryWrapper.orderByDesc("create_time");
            List<OmsCycle> retList = super.list(queryWrapper);
            if(retList!=null && retList.size()>0){
                OmsCycle retData = retList.get(0);

                return retData;
            }
            return null;
      } catch (Exception e) {
          e.printStackTrace();
          throw new BizException("-1",e,false);
      }
  }
/**
   * 3-4-04新增综合周期[5071]
   * gen by moon at 1/1/2023, 5:12:28 PM
   */
 @Trace(operationName = "3-4-04新增综合周期")
 @Tags({@Tag(key = "参数",value = "arg[0]"),
 @Tag(key = "返回值",value = "returnedObj")})
  @Override
  @Transactional(rollbackFor=Exception.class)
  public  String  addSyntheticalCycle(OmsCycle omsCycle) {
     omsCycle.setCycleId(CommonFunctionHelper.getUid());//DISTRIBUTED_ID
omsCycle.setOperateTime(CommonFunctionHelper.getCurrentTime());//SYSTEM_CURRENT_TIME
omsCycle.setCreateTime(CommonFunctionHelper.getCurrentTime());//SYSTEM_CURRENT_TIME
if(omsCycle!=null && omsCycle.getSubjectLifeCycle()!=null && omsCycle.getSubjectLifeCycle().equals("CURRENTLY_VALID")){
             omsCycle.setReleaseTime(CommonFunctionHelper.getCurrentTime());//RELEASE_SYSTEM_CURRENT_TIME
            }
omsCycle.setIsValid("FALSE");
     if(super.save(omsCycle)){
        return omsCycle.getCycleId();
     }else {
        return "-1";
     }
    
  }
/**
   * 3-4-04查询周期内周期列表[5341]
   * gen by moon at 11/30/2022, 2:05:55 AM
   */
 @Trace(operationName = "3-4-04查询周期内周期列表")
 @Tags({@Tag(key = "参数",value = "arg[0]"),
 @Tag(key = "返回值",value = "returnedObj")})
  @Override
  @Transactional(rollbackFor=Exception.class)
 @BanAuto
  public  List<OmsCycle>  queryCycleWithinCycleList(QueryCycleWithinCycleListReq reqDto) {

        try {
            QueryWrapper<OmsCycle> queryWrapper = new QueryWrapper<>();
            reqDto.setIsValid("FALSE");

            if(reqDto.getCycleStartTime()!=null && reqDto.getCycleEndTime()!=null){
                queryWrapper.ge("cycle_start_time",reqDto.getCycleStartTime());
                queryWrapper.le("cycle_end_time",reqDto.getCycleEndTime());
                reqDto.setCycleStartTime(null);
                reqDto.setCycleEndTime(null);
            }

            Map<String, Object> fieldInfoMap = null;
            fieldInfoMap = CommonFunctionHelper.objectToMapForLamBda(reqDto);
            List<FieldInfo> compareList = CommonFunctionHelper.getRangeField(OmsCycle.class);
            CommonFunctionHelper.buildQueryWrapperCompare(queryWrapper, compareList, fieldInfoMap);
            List<FieldInfo> likeList = CommonFunctionHelper.getLikeFiled(OmsCycle.class);
            CommonFunctionHelper.buildQueryWrapperLike(queryWrapper,likeList,fieldInfoMap);
            likeList.addAll(compareList);
            CommonFunctionHelper.buildQueryWrapperEq(queryWrapper, fieldInfoMap,likeList);
            List<FieldInfo> orderList = CommonFunctionHelper.getOrderList(OmsCycle.class);
            //CommonFunctionHelper.buildQueryWrapperOrder(queryWrapper, orderList);

            return ((List<OmsCycle>) super.list(queryWrapper));
        } catch (Exception e) {
            e.printStackTrace();
            throw new BizException("-1",e,false);
        }
  }
/**
   * 3-4-04查询时间等于查周期详情详情[5379]
   * gen by moon at 3/30/2023, 6:54:11 PM
   */
 @Trace(operationName = "3-4-04查询时间等于查周期详情详情")
 @Tags({@Tag(key = "参数",value = "arg[0]"),
 @Tag(key = "返回值",value = "returnedObj")})
  @Override
  @Transactional(rollbackFor=Exception.class)
  public  OmsCycle  queryTimeEqualQueryCycleDetailsDetail(QueryTimeEqualQueryCycleDetailsDetailReq reqDto) {
     
        try {
         reqDto.setIsValid("FALSE");
            QueryWrapper<OmsCycle> queryWrapper = new QueryWrapper<>();
            Map<String, Object> fieldInfoMap = null;
            fieldInfoMap = CommonFunctionHelper.objectToMapForLamBda(reqDto);
            CommonFunctionHelper.buildQueryWrapperEq(queryWrapper, fieldInfoMap, new ArrayList<>());
            queryWrapper.orderByDesc("create_time");
            List<OmsCycle> retList = super.list(queryWrapper);
            if(retList!=null && retList.size()>0){
                OmsCycle retData = retList.get(0);
                
                return retData;
            }
            return null;
      } catch (Exception e) {
          e.printStackTrace();
          throw new BizException("-1",e,false);
      }
  }
/**
   * 3-4-04批量删周期[5383]
   * gen by moon at 1/1/2023, 5:12:30 PM
   */
 @Trace(operationName = "3-4-04批量删周期")
 @Tags({@Tag(key = "参数",value = "arg[0]"),
 @Tag(key = "返回值",value = "returnedObj")})
  @Override
  @Transactional(rollbackFor=Exception.class)
  public  boolean  batchDeleteCycle(List<String> reqDto) {
     
          if(reqDto==null || reqDto.size()==0){
            return false;
          }
          
          return super.removeByIds(reqDto);
  }
/**
   * 3-4-04查询租户周期列表ByCodes[5284]
   * gen by moon at 2/16/2023, 9:50:29 PM
   */
 @Trace(operationName = "3-4-04查询租户周期列表ByCodes")
 @Tags({@Tag(key = "参数",value = "arg[0]"),
 @Tag(key = "返回值",value = "returnedObj")})
  @Override
  @Transactional(rollbackFor=Exception.class)
  public  List<OmsCycle>  batchQueryTenantCycleListByCodes(BatchQueryTenantCycleListByCodesReq reqDto) {

        try {
            QueryWrapper<OmsCycle> queryWrapper = new QueryWrapper<>();
            reqDto.setSubjectLifeCycle("CURRENTLY_VALID");
            if(reqDto.getTenantCycleList()==null || reqDto.getTenantCycleList().isEmpty()){
                    return new ArrayList<>();
                }
        queryWrapper.in("cycle_type_code", reqDto.getTenantCycleList());
            Map<String, Object> fieldInfoMap = null;
            fieldInfoMap = CommonFunctionHelper.objectToMapForLamBda(reqDto);
            List<FieldInfo> compareList = CommonFunctionHelper.getRangeField(OmsCycle.class);
            CommonFunctionHelper.buildQueryWrapperCompare(queryWrapper, compareList, fieldInfoMap);
            List<FieldInfo> likeList = CommonFunctionHelper.getLikeFiled(OmsCycle.class);
            CommonFunctionHelper.buildQueryWrapperLike(queryWrapper,likeList,fieldInfoMap);
            likeList.addAll(compareList);
            CommonFunctionHelper.buildQueryWrapperEq(queryWrapper, fieldInfoMap,likeList);
            List<FieldInfo> orderList = CommonFunctionHelper.getOrderList(OmsCycle.class);
            //CommonFunctionHelper.buildQueryWrapperOrder(queryWrapper, orderList);

            return ((List<OmsCycle>) super.list(queryWrapper));
        } catch (Exception e) {
            e.printStackTrace();
            throw new BizException("-1",e,false);
        }
  }
/**
   * 3-4-04批量查询周期类型匹配周期[5972]
   * gen by moon at 2/20/2023, 12:13:47 PM
   */
 @Trace(operationName = "3-4-04批量查询周期类型匹配周期")
 @Tags({@Tag(key = "参数",value = "arg[0]"),
 @Tag(key = "返回值",value = "returnedObj")})
  @Override
  @Transactional(rollbackFor=Exception.class)
 @BanAuto
  public  List<OmsCycle>  batchQueryCycleTypeMatchCycle(BatchQueryCycleTypeMatchCycleReq reqDto) {

        try {
            QueryWrapper<OmsCycle> queryWrapper = new QueryWrapper<>();

            if(reqDto.getCycleList()==null || reqDto.getCycleList().isEmpty()){
                    return new ArrayList<>();
                }

            if(reqDto.getCycleStartTime()!=null && reqDto.getCycleEndTime()!=null){
                queryWrapper.le("cycle_start_time",reqDto.getCycleStartTime());
                queryWrapper.le("cycle_end_time",reqDto.getCycleEndTime());
                reqDto.setCycleStartTime(null);
                reqDto.setCycleEndTime(null);
            }
        queryWrapper.in("cycle_type_code", reqDto.getCycleList());
            Map<String, Object> fieldInfoMap = null;
            fieldInfoMap = CommonFunctionHelper.objectToMapForLamBda(reqDto);
            List<FieldInfo> compareList = CommonFunctionHelper.getRangeField(OmsCycle.class);
            CommonFunctionHelper.buildQueryWrapperCompare(queryWrapper, compareList, fieldInfoMap);
            List<FieldInfo> likeList = CommonFunctionHelper.getLikeFiled(OmsCycle.class);
            CommonFunctionHelper.buildQueryWrapperLike(queryWrapper,likeList,fieldInfoMap);
            likeList.addAll(compareList);
            CommonFunctionHelper.buildQueryWrapperEq(queryWrapper, fieldInfoMap,likeList);
            List<FieldInfo> orderList = CommonFunctionHelper.getOrderList(OmsCycle.class);
            //CommonFunctionHelper.buildQueryWrapperOrder(queryWrapper, orderList);
            queryWrapper.orderByAsc("order_number");
queryWrapper.orderByDesc("operate_time");
            return ((List<OmsCycle>) super.list(queryWrapper));
        } catch (Exception e) {
            e.printStackTrace();
            throw new BizException("-1",e,false);
        }
  }
/**
   * 3-4-04查询向右过程周期列表ByCodes[6070]
   * gen by moon at 5/13/2023, 9:11:12 PM
   */
 @Trace(operationName = "3-4-04查询向右过程周期列表ByCodes")
 @Tags({@Tag(key = "参数",value = "arg[0]"),
 @Tag(key = "返回值",value = "returnedObj")})
  @Override
  @Transactional(rollbackFor=Exception.class)
  public  List<OmsCycle>  batchQueryRightProcessCycleByCodeListByCodes(BatchQueryRightProcessCycleByCodeListByCodesReq reqDto) {
     
        try {
            QueryWrapper<OmsCycle> queryWrapper = new QueryWrapper<>();
            
            if(reqDto.getCycleList()==null || reqDto.getCycleList().isEmpty()){
                    return new ArrayList<>();
                }
// TODO: 2023/3/20
            if(reqDto.getCycleStartTime()!=null && reqDto.getCycleEndTime()!=null){
                queryWrapper.le("cycle_start_time",reqDto.getCycleStartTime());
                queryWrapper.ge("cycle_end_time",reqDto.getCycleEndTime());
                reqDto.setCycleStartTime(null);
                reqDto.setCycleEndTime(null);
            }
        queryWrapper.in("cycle_type_code", reqDto.getCycleList());
            Map<String, Object> fieldInfoMap = null;
            fieldInfoMap = CommonFunctionHelper.objectToMapForLamBda(reqDto);
            List<FieldInfo> compareList = CommonFunctionHelper.getRangeField(OmsCycle.class);
            CommonFunctionHelper.buildQueryWrapperCompare(queryWrapper, compareList, fieldInfoMap);
            List<FieldInfo> likeList = CommonFunctionHelper.getLikeFiled(OmsCycle.class);
            CommonFunctionHelper.buildQueryWrapperLike(queryWrapper,likeList,fieldInfoMap);
            likeList.addAll(compareList);
            CommonFunctionHelper.buildQueryWrapperEq(queryWrapper, fieldInfoMap,likeList);
            List<FieldInfo> orderList = CommonFunctionHelper.getOrderList(OmsCycle.class);
            //CommonFunctionHelper.buildQueryWrapperOrder(queryWrapper, orderList);
            queryWrapper.orderByDesc("order_number");
queryWrapper.orderByDesc("operate_time");
            return ((List<OmsCycle>) super.list(queryWrapper));
        } catch (Exception e) {
            e.printStackTrace();
            throw new BizException("-1",e,false);
        }
  }
/**
   * 3-4-04查询最小周期[6663]
   * gen by moon at 5/14/2023, 2:49:17 AM
   */
 @Trace(operationName = "3-4-04查询最小周期")
 @Tags({@Tag(key = "参数",value = "arg[0]"),
 @Tag(key = "返回值",value = "returnedObj")})
  @Override
  @Transactional(rollbackFor=Exception.class)
 @BanAuto
  public  OmsCycle  queryMinimumCycleDetail(QueryMinimumCycleDetailReq reqDto) {

        try {
         reqDto.setIsValid("FALSE");
            QueryWrapper<OmsCycle> queryWrapper = new QueryWrapper<>();
            // TODO: 2023/3/20
            if(reqDto.getCycleStartTime()!=null && reqDto.getCycleEndTime()!=null){
                queryWrapper.ge("cycle_start_time",reqDto.getCycleStartTime());
                queryWrapper.le("cycle_end_time",reqDto.getCycleEndTime());
                reqDto.setCycleStartTime(null);
                reqDto.setCycleEndTime(null);
            }
            Map<String, Object> fieldInfoMap = null;
            fieldInfoMap = CommonFunctionHelper.objectToMapForLamBda(reqDto);
            CommonFunctionHelper.buildQueryWrapperEq(queryWrapper, fieldInfoMap, new ArrayList<>());
            // TODO: 2023/5/14 手写代码 
            queryWrapper.orderByDesc("order_number");
            queryWrapper.orderByDesc("create_time");
            List<OmsCycle> retList = super.list(queryWrapper);
            if(retList!=null && retList.size()>0){
                OmsCycle retData = retList.get(0);

                return retData;
            }
            return null;
      } catch (Exception e) {
          e.printStackTrace();
          throw new BizException("-1",e,false);
      }
  }
/**
   * 3-4-04查询最大周期[6664]
   * gen by moon at 5/14/2023, 2:49:21 AM
   */
 @Trace(operationName = "3-4-04查询最大周期")
 @Tags({@Tag(key = "参数",value = "arg[0]"),
 @Tag(key = "返回值",value = "returnedObj")})
  @Override
  @Transactional(rollbackFor=Exception.class)
 @BanAuto
  public  OmsCycle  queryMaximumCycleDetail(QueryMaximumCycleDetailReq reqDto) {

        try {
         reqDto.setIsValid("FALSE");
            QueryWrapper<OmsCycle> queryWrapper = new QueryWrapper<>();
            // TODO: 2023/3/20
            if(reqDto.getCycleStartTime()!=null && reqDto.getCycleEndTime()!=null){
                queryWrapper.ge("cycle_start_time",reqDto.getCycleStartTime());
                queryWrapper.le("cycle_end_time",reqDto.getCycleEndTime());
                reqDto.setCycleStartTime(null);
                reqDto.setCycleEndTime(null);
            }
            Map<String, Object> fieldInfoMap = null;
            fieldInfoMap = CommonFunctionHelper.objectToMapForLamBda(reqDto);
            CommonFunctionHelper.buildQueryWrapperEq(queryWrapper, fieldInfoMap, new ArrayList<>());
            // TODO: 2023/5/14 手写代码 
            queryWrapper.orderByAsc("order_number");
            queryWrapper.orderByDesc("create_time");
            List<OmsCycle> retList = super.list(queryWrapper);
            if(retList!=null && retList.size()>0){
                OmsCycle retData = retList.get(0);

                return retData;
            }
            return null;
      } catch (Exception e) {
          e.printStackTrace();
          throw new BizException("-1",e,false);
        }
  }
/**
   * 3-4-04根据时间范围查询周期详情（开始小于等于结束大于等于）[7005]
   * gen by moon at 5/29/2023, 2:09:11 PM
   */
 @Trace(operationName = "3-4-04根据时间范围查询周期详情（开始小于等于结束大于等于）")
 @Tags({@Tag(key = "参数",value = "arg[0]"),
 @Tag(key = "返回值",value = "returnedObj")})
  @Override
  @Transactional(rollbackFor=Exception.class)
  public  OmsCycle  queryTimeRangeFindCycleDetail(QueryTimeRangeFindCycleDetailReq reqDto) {

        try {
         reqDto.setIsValid("FALSE");
            QueryWrapper<OmsCycle> queryWrapper = new QueryWrapper<>();

            // TODO: 2023/5/29
            if(reqDto.getCycleStartTime()!=null && reqDto.getCycleEndTime()!=null){
                queryWrapper.le("cycle_start_time",reqDto.getCycleStartTime());
                queryWrapper.ge("cycle_end_time",reqDto.getCycleEndTime());
                reqDto.setCycleStartTime(null);
                reqDto.setCycleEndTime(null);
            }

            Map<String, Object> fieldInfoMap = null;
            fieldInfoMap = CommonFunctionHelper.objectToMapForLamBda(reqDto);
            CommonFunctionHelper.buildQueryWrapperEq(queryWrapper, fieldInfoMap, new ArrayList<>());


            queryWrapper.orderByDesc("create_time");
            List<OmsCycle> retList = super.list(queryWrapper);
            if(retList!=null && retList.size()>0){
                OmsCycle retData = retList.get(0);

                return retData;
            }
            return null;
      } catch (Exception e) {
          e.printStackTrace();
          throw new BizException("-1",e,false);
      }
  }
/**
   * 3-4-04查询周期（开始大于等于结束小于等于）列表[8993]
   * gen by moon at 4/1/2024, 12:11:20 AM
   */
 @Trace(operationName = "3-4-04查询周期（开始大于等于结束小于等于）列表")
 @Tags({@Tag(key = "参数",value = "arg[0]"),
 @Tag(key = "返回值",value = "returnedObj")})
  @Override
  @Transactional(rollbackFor=Exception.class)
  public  List<OmsCycle>  queryCycleByEqualGreateAndLessGreateList(QueryCycleByEqualGreateAndLessGreateListReq reqDto) {

        try {
            QueryWrapper<OmsCycle> queryWrapper = new QueryWrapper<>();
            reqDto.setIsValid("FALSE");

            if(reqDto.getCycleStartTime()!=null && reqDto.getCycleEndTime()!=null){
                queryWrapper.ge("cycle_start_time",reqDto.getCycleStartTime());
                queryWrapper.le("cycle_end_time",reqDto.getCycleEndTime());
                reqDto.setCycleStartTime(null);
                reqDto.setCycleEndTime(null);
            }

            Map<String, Object> fieldInfoMap = null;
            fieldInfoMap = CommonFunctionHelper.objectToMapForLamBda(reqDto);
            List<FieldInfo> compareList = CommonFunctionHelper.getRangeField(OmsCycle.class);
            CommonFunctionHelper.buildQueryWrapperCompare(queryWrapper, compareList, fieldInfoMap);
            List<FieldInfo> likeList = CommonFunctionHelper.getLikeFiled(OmsCycle.class);
            CommonFunctionHelper.buildQueryWrapperLike(queryWrapper,likeList,fieldInfoMap);
            likeList.addAll(compareList);
            CommonFunctionHelper.buildQueryWrapperEq(queryWrapper, fieldInfoMap,likeList);
            List<FieldInfo> orderList = CommonFunctionHelper.getOrderList(OmsCycle.class);
            //CommonFunctionHelper.buildQueryWrapperOrder(queryWrapper, orderList);

            return ((List<OmsCycle>) super.list(queryWrapper));
        } catch (Exception e) {
            e.printStackTrace();
            throw new BizException("-1",e,false);
        }
  }
/**
   * 3-4-04查询周期详情（起止时间等于）[9823]
   * gen by moon at 6/16/2024, 7:31:18 PM
   */
 @Trace(operationName = "3-4-04查询周期详情（起止时间等于）")
 @Tags({@Tag(key = "参数",value = "arg[0]"),
 @Tag(key = "返回值",value = "returnedObj")})
  @Override
  @Transactional(rollbackFor=Exception.class)
  public  OmsCycle  queryCycleByTimeEqualDetail(QueryCycleByTimeEqualDetailReq reqDto) {

        try {

            QueryWrapper<OmsCycle> queryWrapper = new QueryWrapper<>();
            Map<String, Object> fieldInfoMap = null;
            fieldInfoMap = CommonFunctionHelper.objectToMapForLamBda(reqDto);
            CommonFunctionHelper.buildQueryWrapperEq(queryWrapper, fieldInfoMap, new ArrayList<>());
            queryWrapper.orderByDesc("create_time");
            List<OmsCycle> retList = super.list(queryWrapper);
            if(retList!=null && retList.size()>0){
                OmsCycle retData = retList.get(0);

                return retData;
            }
            return null;
      } catch (Exception e) {
          e.printStackTrace();
          throw new BizException("-1",e,false);
        }
  }
}
